
describe("MoveToListController for India", function() {
    var controller = null;
    var currentTransfer = null;

    beforeEach(function() {

        var t_alertCtrl = App.AlertController.create();
        var t_loadingCtrl = App.LoadingController.create();
        var t_moveHolderCtrl = App.MoveHolderController.create();
        App.MoveToListController.reopen({
            init:function(){
                this.set('controllers.alert', t_alertCtrl);
                this.set('controllers.loading', t_loadingCtrl);
                this.set('controllers.moveHolder', t_moveHolderCtrl);
            }
        });

        controller = App.MoveToListController.create();
    });

    it("selectListItem - card account", function() {

        var account = App.CardAccount.create();
        spyOn(controller, 'showLoading');
        spyOn(App.api_accountDetail, 'getAccountDetails').andCallFake(function(account,callback){
            callback(account);
        });
        spyOn(controller, 'hasError').andReturn(false)
        spyOn(controller, 'setDestinationAccount');
        spyOn(controller, 'transitionTo');

        controller.selectListItem(account);

        expect(controller.hasError).toHaveBeenCalled();
        expect(controller.setDestinationAccount).toHaveBeenCalled();
        expect(controller.transitionTo).toHaveBeenCalledWith('move.fromList');
    });
    it("selectListItem - other account", function() {
        var account = App.HaveAccount.create();
        spyOn(controller, 'setDestinationAccount');
        spyOn(controller, 'transitionTo');

        controller.selectListItem(account);

        expect(controller.setDestinationAccount).toHaveBeenCalled();
        expect(controller.transitionTo).toHaveBeenCalledWith('move.fromList');
    });
});